﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTOQLDV;

namespace DAOQLDV
{
    internal class DAOTuKhoaTinhThanh
    {
        public static bool ThemTuKhoaTinhThanh(DTOTinhThanh dtoTT, DataAccess da)
        {
            bool kq = false;
            try
            {
                List<String> dsTuKhoa = DAOXuLi.dsTuKhoa(dtoTT.TenTinhThanh);
                String sql = "";
                foreach (String tkhoa in dsTuKhoa)
                {
                    sql = "Insert Into TuKhoaTenTinhThanh(TenTuKhoaTinhThanh, MaTinhThanh) Value ('" + tkhoa + "', " + dtoTT.MaTinhThanh + ")";
                    da.ExecuteNonQuery(sql);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return kq;
        }        
    }
}
